/*
 * LineParseCase.cpp
 *
 *  Created on: 2012-12-21
 *      Author: yangentao@gmail.com
 */

#include "test.h"
#include "../src/yet/LineParse.h"

using namespace yet;

TEST(LineParse, a0) {
	string s;
	LineParse p(s);
	EXPECT_EQ(p.getLineCount(), 0);
}
TEST(LineParse, a1) {
	string s("abc");
	LineParse p(s);
	EXPECT_EQ(p.getLineCount(), 1);
	EXPECT_TRUE(p.getLineTextFull(0) == s);
}
TEST(LineParse, a2) {
	string s("abc\n");
	LineParse p(s);
	EXPECT_EQ(p.getLineCount(), 1);
	EXPECT_TRUE(p.getLineTextFull(0) == s);
	string linetext =p.getLineText(0);
	bool b = linetext == string("abc");
	EXPECT_TRUE(b)<<"  "<<linetext.length()<<" "<<p.getLineText(0);
}
TEST(LineParse, a3) {
	string s("abc\ndef");
	LineParse p(s);
	EXPECT_EQ(p.getLineCount(), 2);
	EXPECT_TRUE(p.getLineTextFull(0) == "abc\n");
	EXPECT_TRUE(p.getLineText(0) == "abc");
	EXPECT_TRUE(p.getLineTextFull(1) == "def");
	EXPECT_TRUE(p.getLineText(1) == "def");
}

